package com.hualude.roadsign.service.impl;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.UserDto;
import com.hualude.roadsign.repository.UserRepository;
import com.hualude.roadsign.service.LogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by shao-yikun on 2017/5/1.
 */

@Service
public class LogServiceImpl implements LogService {

    @Resource
    private UserRepository userRepository;

    @Override
    public DTResponseDto getLog4DT(DTRequestDto dtRequestDto) throws Exception {
        List<UserDto> userDtos = userRepository.getLog4DT(dtRequestDto);
        Integer count = userRepository.getLogCount4DT(dtRequestDto.getSearch());
        return new DTResponseDto(dtRequestDto.getDraw(), count, count, userDtos);
    }
}
